package com.itheima.d2_array;


public class Test4 {
    public static void main(String[] args) {
        // 需求：设计一个方法，可以接收一个数组作为参数，方法内计算并返回数组中的最大值
        int[] faceScores = {15, 9000, 10000, 20000, 9500, -5};
        int max = faceScores[0];
        for (int i = 1; i < faceScores.length; i++) {
            if (faceScores[i] > max) {
                max = faceScores[i];
            }

        }
        System.out.println(max);

        System.out.println("---------------");

        int[] faceScores1 = {15, 9000, 10000, 20000, 9500, -5};
        int min = faceScores1[0];
        for (int i = 1; i < faceScores.length; i++) {
            if (faceScores[i] < min) {
                min = faceScores[i];
            }
        }
        System.out.println(min);

    }
}
